home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d2
/
sysid47.arc
/
SYSID.LST
< prev
next >
Wrap
File List
|
1989-12-17
|
35KB
|
637 lines
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 1
SYSID.ASM
1
2 ;--------------------------------------------------------------------
3 ;
4 ; SYSID.ASM
5 ;
6 ; Version 4.7
7 ;
8 ; Two subprograms used by SYSID.PAS:
9 ;
10 ; CPUID - identifies host CPU and NDP (if
11 ; any)
12 ; DISKREAD - reads absolute sectors from disk
13 ;
14 ; Steve Grant
15 ; Long Beach, CA
16 ; July 31, 1989
17 ;
18 ;--------------------------------------------------------------------
19
20 .8086
21 .8087
22
23 public CPUID, DISKREAD
24
25 0000 CODE segment byte
26
27 ;--------------------------------------------------------------------
28
29 0000 CPUID proc near
30
31 assume cs:CODE, ds:DATA, es:nothing, ss:nothing
32
33 ; On entry:
34 ;
35 ; BP
36 ; SP => near return address
37 ; offset of a cpu_info_t record
38 ; segment " " " "
39 ;
40 ; On exit, the cpu_info_t record has been filled in as follows:
41 ;
42 ; byte = CPU type
43 ; word = Machine Status Word
44 ; 6 bytes = Global Descriptor Table
45 ; 6 bytes = Interrupt Descriptor Table
46 ; boolean = segment register change/interrupt flag
47 ; boolean = 80386 multiplication bug flag
48 ; byte = NDP type
49 ; word = NDP control word
50
51 = mCPU equ byte ptr [bx]
52 = mMSW equ [bx + 1]
53 = mGDT equ [bx + 3]
54 = mIDT equ [bx + 9]
55 = mopsize equ byte ptr [bx + 15]
56 = mchkint equ byte ptr [bx + 16]
57 = mmult equ byte ptr [bx + 17]
58 = mNDP equ byte ptr [bx + 18]
59 = mNDPCW equ [bx + 19]
60
61 = 0000 f8088 equ 0
62 = 0001 f8086 equ 1
63 = 0002 fV20 equ 2
64 = 0003 fV30 equ 3
65 = 0004 f80188 equ 4
66 = 0005 f80186 equ 5
67 = 0006 f80286 equ 6
68 = 0007 f80386 equ 7
69 = 00FF funk = 0FFH
70
71 = 0000 false equ 0
72 = 0001 true equ 1
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 2
SYSID.ASM
73
74 0000 55 push bp
75 0001 8B EC mov bp, sp
76 0003 1E push ds
77 0004 C5 5E 04 lds bx, [bp + 4]
78 0007 E8 000B call cpu
79 000A E8 00E6 call chkint
80 000D E8 0132 call ndp
81 0010 1F pop ds
82 0011 5D pop bp
83 0012 C2 0004 ret 4
84
85 ;--------------------------------------------------------------------
86
87 0015 cpu proc near
88
89 ; interrupt of multi-prefix string instruction
90
91 0015 FB sti
92 0016 B9 FFFF mov cx, 0FFFFH
93 0019 F3> 26: AC rep lods byte ptr es : [si]
94 001C E3 18 jcxz cpu_03
95
96 001E E8 00B1 call piq
97 0021 83 FA 04 cmp dx, 4
98 0024 75 04 jne cpu_01
99
100 0026 C6 07 00 mov mCPU, f8088
101 0029 C3 ret
102
103 cpu_01:
104 002A 83 FA 06 cmp dx, 6
105 002D 74 03 je cpu_02
106
107 002F E9 009C jmp cpu_12
108
109 cpu_02:
110 0032 C6 07 01 mov mCPU, f8086
111 0035 C3 ret
112
113 cpu_03:
114
115 ; number of bits in displacement register used by shift
116
117 0036 B0 FF mov al, 0FFH
118 0038 B1 20 mov cl, 20H
119 003A D2 E0 shl al, cl
120 003C 0A C0 or al, al
121 003E 75 15 jnz cpu_05
122
123 0040 E8 008F call piq
124 0043 83 FA 04 cmp dx, 4
125 0046 75 04 jne cpu_04
126
127 0048 C6 07 02 mov mCPU, fV20
128 004B C3 ret
129
130 cpu_04:
131 004C 83 FA 06 cmp dx, 6
132 004F 75 7D jne cpu_12
133
134 0051 C6 07 03 mov mCPU, fV30
135 0054 C3 ret
136
137 cpu_05:
138
139 ; order of write/decrement by PUSH SP
140
141 0055 54 push sp
142 0056 58 pop ax
143 0057 3B C4 cmp ax, sp
144 0059 74 15 je cpu_07
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 3
SYSID.ASM
145
146 005B E8 0074 call piq
147 005E 83 FA 04 cmp dx, 4
148 0061 75 04 jne cpu_06
149
150 0063 C6 07 04 mov mCPU, f80188
151 0066 C3 ret
152
153 cpu_06:
154 0067 83 FA 06 cmp dx, 6
155 006A 75 62 jne cpu_12
156
157 006C C6 07 05 mov mCPU, f80186
158 006F C3 ret
159
160 cpu_07:
161
162 .286P
163
164 0070 0F 01 67 01 smsw mMSW
165 0074 0F 01 47 03 sgdt mGDT
166 0078 0F 01 4F 09 sidt mIDT
167
168 .8086
169
170 ; try to alter flag register bits 15-12
171
172 007C 9C pushf
173 007D 58 pop ax
174 007E 8B C8 mov cx, ax
175 0080 81 F1 F000 xor cx, 0F000H
176 0084 51 push cx
177 0085 9D popf
178 0086 9C pushf
179 0087 59 pop cx
180 0088 3B C1 cmp ax, cx
181 008A 75 04 jne cpu_08
182
183 008C C6 07 06 mov mCPU, f80286
184 008F C3 ret
185
186 cpu_08:
187 0090 C6 07 07 mov mCPU, f80386
188 0093 9C pushf
189 0094 8B C4 mov ax, sp
190 0096 9D popf
191 0097 40 inc ax
192 0098 40 inc ax
193 0099 3B C4 cmp ax, sp
194 009B 75 06 jnz cpu_09
195
196 009D C6 47 0F 00 mov mopsize, false
197 00A1 EB 04 jmp short cpu_10
198
199 cpu_09:
200 00A3 C6 47 0F 01 mov mopsize, true
201
202 cpu_10:
203
204 .386P
205
206 00A7 66| B8 0417A000 mov eax, 0417A000H
207 00AD 66| B9 00000081 mov ecx, 81H
208 00B3 66| F7 E1 mul ecx
209 00B6 66| 83 FA 02 cmp edx, 2
210 00BA 75 0D jne short cpu_11
211
212 00BC 66| 3D 0FE7A000 cmp eax, 0FE7A000H
213 00C2 75 05 jne short cpu_11
214
215 00C4 C6 47 11 01 mov mmult, true
216 00C8 C3 ret
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 4
SYSID.ASM
217
218 cpu_11:
219 00C9 C6 47 11 00 mov mmult, false
220 00CD C3 ret
221
222 ; BIX ibm.at/hardware #4663
223
224 .8086
225
226 cpu_12:
227 00CE C6 07 FF mov mCPU, funk
228 00D1 C3 ret
229
230 00D2 cpu endp
231
232 ;--------------------------------------------------------------------
233
234 00D2 piq proc near
235
236 ; On exit:
237 ;
238 ; DX = length of prefetch instruction queue
239 ;
240 ; This subroutine uses self-modifying code but can nevertheless
241 ; be run repeatedly in the course of the calling program.
242
243 = 0007 count = 7
244 = 0042 opincdx equ 42H ; inc dx opcode
245 = 0090 opnop equ 90H ; nop opcode
246
247 00D2 B0 42 mov al, opincdx
248 00D4 B9 0007 mov cx, count
249 00D7 51 push cx
250 00D8 0E push cs
251 00D9 07 pop es
252 00DA BF 00F0r mov di, offset piq_01 - 1
253 00DD 57 push di
254 00DE FD std
255 00DF F3> AA rep stosb
256 00E1 B0 90 mov al, opnop
257 00E3 5F pop di
258 00E4 59 pop cx
259 00E5 33 D2 xor dx, dx
260 00E7 FA cli
261 00E8 F3> AA rep stosb
262 rept count
263 inc dx
264 endm
1 265 00EA 42 inc dx
1 266 00EB 42 inc dx
1 267 00EC 42 inc dx
1 268 00ED 42 inc dx
1 269 00EE 42 inc dx
1 270 00EF 42 inc dx
1 271 00F0 42 inc dx
272
273 piq_01:
274 00F1 FB sti
275 00F2 C3 ret
276
277 00F3 piq endp
278
279 ;--------------------------------------------------------------------
280
281 00F3 chkint proc near
282
283 ; save old INT 01H vector
284
285 00F3 53 push bx
286 00F4 B8 3501 mov ax, 3501H
287 00F7 CD 21 int 21H
288 00F9 89 1E 0000r mov old_int01_ofs, bx
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 5
SYSID.ASM
289 00FD 8C 06 0002r mov old_int01_seg, es
290 0101 5B pop bx
291
292 ; redirect INT 01H vector
293
294 0102 1E push ds
295 0103 B8 2501 mov ax, 2501H
296 0106 BA 0000s mov dx, seg new_int01
297 0109 8E DA mov ds, dx
298 010B BA 0126r mov dx, offset new_int01
299 010E CD 21 int 21H
300 0110 1F pop ds
301
302 ; set TF and change SS -- did we trap on following instruction?
303
304 0111 9C pushf
305 0112 58 pop ax
306 0113 80 CC 01 or ah, 01H ; set TF
307 0116 50 push ax
308 0117 9D popf
309 0118 16 push ss ; CPU may wait one
310 ; instruction before
311 ; recognizing single step
312 ; interrupt
313 0119 17 pop ss
314
315 chkint_01: ; shouldn't ever trap here
316
317 ; restore old INT 01H vector
318
319 011A 1E push ds
320 011B B8 2501 mov ax, 2501H
321 011E C5 16 0000r lds dx, old_int01
322 0122 CD 21 int 21H
323 0124 1F pop ds
324 0125 C3 ret
325
326 ;--------------------------------------------------------------------
327
328 new_int01:
329
330 ; INT 01H handler (single step)
331 ;
332 ; On entry:
333 ;
334 ; SP => IP
335 ; CS
336 ; flags
337
338 0126 FB sti
339 0127 58 pop ax ; IP
340 0128 3D 011Ar cmp ax, offset chkint_01
341 012B 72 13 jb new_int01_03
342 012D 74 06 je new_int01_01
343 012F C6 47 10 01 mov mchkint, true
344 0133 EB 04 jmp short new_int01_02
345
346 new_int01_01:
347 0135 C6 47 10 00 mov mchkint, false
348
349 new_int01_02:
350 0139 59 pop cx ; CS
351 013A 5A pop dx ; flags
352 013B 80 E6 FE and dh, 0FEH ; turn off TF
353 013E 52 push dx ; flags
354 013F 51 push cx ; CS
355
356 new_int01_03:
357 0140 50 push ax ; IP
358 0141 CF iret
359
360 0142 chkint endp
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 6
SYSID.ASM
361
362 ;--------------------------------------------------------------------
363
364 0142 ndp proc near
365
366 = 0000 fnone equ 0
367 = 0001 f8087 equ 1
368 = 0002 f80287 equ 2
369 = 0003 f80387 equ 3
370 = 00FF funk = 0FFH
371
372 0142 C7 06 0004r 0000 mov ndp_cw, 0000H
373 0148 FA cli
374
375 ; The next three 80x87 instructions cannot carry the WAIT prefix,
376 ; because there may not be an 80x87 for which to wait. The WAIT is
377 ; therefore emulated with a MOV CX,<value>! LOOP $ combination.
378
379 ; CPU NDP
380 0149 DD 36 0006r fnsave ndp_save ; 14 221
381 014D B9 000D mov cx, (221 - 23 + 16) / 17 + 1 ; 4
382 0150 E2 FE loop $ ; 17*CX+5
383 ; 17*CX+23
384
385 0152 DB E3 fninit ; 8 8
386 0154 B9 0001 mov cx, (8 - 17 + 16) / 17 + 1 ; 4
387 0157 E2 FE loop $ ; 17*CX+5
388 ; 17*CX+17
389
390 0159 D9 3E 0004r fnstcw ndp_cw ; 14 24
391 015D B9 0002 mov cx, (24 - 23 + 16) / 17 + 1 ; 4
392 0160 E2 FE loop $ ; 17*CX+5
393 ; 17*CX+23
394
395 0162 FB sti
396 0163 A1 0004r mov ax, ndp_cw
397 0166 3D 0000 cmp ax, 0000H
398 0169 75 05 jne ndp_01
399
400 016B C6 47 12 00 mov mNDP, fnone
401 016F C3 ret
402
403 ndp_01:
404 0170 3D 03FF cmp ax, 03FFH
405 0173 75 06 jne ndp_02
406
407 0175 C6 47 12 01 mov mNDP, f8087
408 0179 EB 3C jmp short ndp_04
409
410 ndp_02:
411 017B 3D 037F cmp ax, 037FH
412 017E 75 41 jne ndp_05
413
414 0180 9B D9 E8 fld1
415 0183 9B D9 EE fldz
416 0186 9B DE F9 fdiv
417 0189 9B D9 E8 fld1
418 018C 9B D9 E0 fchs
419 018F 9B D9 EE fldz
420 0192 9B DE F9 fdiv
421 0195 9B D8 D1 fcom
422 0198 9B DD 3E 0064r fstsw ndp_sw
423 019D A1 0064r mov ax, ndp_sw
424 01A0 80 E4 41 and ah, 41H ; C3, C0
425 01A3 80 FC 40 cmp ah, 40H ; ST(0) = ST(1)
426 01A6 75 06 jne ndp_03
427
428 01A8 C6 47 12 02 mov mNDP, f80287
429 01AC EB 09 jmp short ndp_04
430
431 ndp_03:
432 01AE 80 FC 01 cmp ah, 01H ; ST(0) < ST(1)
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 7
SYSID.ASM
433 01B1 75 0E jne ndp_05
434
435 01B3 C6 47 12 03 mov mNDP, f80387
436
437 ndp_04:
438 01B7 9B DD 26 0006r frstor ndp_save
439 01BC 9B D9 7F 13 fstcw mNDPCW
440 01C0 C3 ret
441
442 ndp_05:
443 01C1 C6 47 12 FF mov mNDP, funk
444 01C5 C3 ret
445
446 01C6 ndp endp
447
448 01C6 CPUID endp
449
450 ;--------------------------------------------------------------------
451
452 01C6 DISKREAD proc near
453
454 assume cs : CODE, ds : nothing, es : nothing
455
456 ; On entry:
457 ;
458 ; BP
459 ; SP => near return address
460 ; offset of disk buffer
461 ; segment " " "
462 ; number of sectors to read
463 ; starting logical sector number
464 ; drive number (0=A, 1=B, etc.)
465 ;
466 ; On exit:
467 ;
468 ; AX = function result
469 ; 00 - function successful
470 ; 01..FF - DOS INT 25H error result
471
472 = drive equ [bp + 12]
473 = starting_sector equ [bp + 10]
474 = number_of_sectors equ [bp + 8]
475 = buffer equ [bp + 4]
476
477 01C6 55 push bp
478 01C7 8B EC mov bp, sp
479 01C9 8A 46 0C mov al, drive
480 01CC 8B 56 0A mov dx, starting_sector
481 01CF 8B 4E 08 mov cx, number_of_sectors
482 01D2 1E push ds
483 01D3 C5 5E 04 lds bx, buffer
484 01D6 CD 25 int 25H
485 01D8 44 inc sp ; fix broken stack
486 01D9 44 inc sp
487 01DA 1F pop ds
488 01DB 72 02 jc diskread_01
489
490 01DD 33 C0 xor ax, ax
491
492 diskread_01:
493 01DF 5D pop bp
494 01E0 C2 000A ret 10
495
496 01E3 DISKREAD endp
497
498 01E3 CODE ends
499
500 ;--------------------------------------------------------------------
501
502 0000 DATA segment byte
503
504 ; storage for CPUID
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 8
SYSID.ASM
505
506 ; redirected INT 01H vector
507
508 old_int01 label dword
509 0000 ???? old_int01_ofs dw ?
510 0002 ???? old_int01_seg dw ?
511
512 ; storage for NDPID
513
514 ; 80x87 control word after initialization, status word after divide
515 by zero
516
517 0004 ???? ndp_cw dw ?
518 0006 5E*(??) ndp_save db 94 dup (?)
519 0064 ???? ndp_sw dw ?
520
521 0066 DATA ends
522
523 end
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 9
Symbol Table
Symbol Name Type Value Cref defined at #
??date Text "07-31-89"
??filename Text "SYSID "
??time Text "08:00:00"
??version Number 0100
@Cpu Text 0101H #20 #21 #162 #168 #204 #224
@FileName Text SYSID
@WordSize Text 2 #20 #21 #25 #162 #168 #204 #224 #502
@curseg Text DATA #25 #502
CPUID Near CODE:0000 23 #29
DISKREAD Near CODE:01C6 23 #452
buffer Text [bp + 4] #475 483
chkint Near CODE:00F3 79 #281
chkint_01 Near CODE:011A #315 340
count Number 0007 #243 248 262
cpu Near CODE:0015 78 #87
cpu_01 Near CODE:002A 98 #103
cpu_02 Near CODE:0032 105 #109
cpu_03 Near CODE:0036 94 #113
cpu_04 Near CODE:004C 125 #130
cpu_05 Near CODE:0055 121 #137
cpu_06 Near CODE:0067 148 #153
cpu_07 Near CODE:0070 144 #160
cpu_08 Near CODE:0090 181 #186
cpu_09 Near CODE:00A3 194 #199
cpu_10 Near CODE:00A7 197 #202
cpu_11 Near CODE:00C9 210 213 #218
cpu_12 Near CODE:00CE 107 132 155 #226
diskread_01 Near CODE:01DF 488 #492
drive Text [bp + 12] #472 479
f80186 Number 0005 #66 157
f80188 Number 0004 #65 150
f80286 Number 0006 #67 183
f80287 Number 0002 #368 428
f80386 Number 0007 #68 187
f80387 Number 0003 #369 435
f8086 Number 0001 #62 110
f8087 Number 0001 #367 407
f8088 Number 0000 #61 100
fV20 Number 0002 #63 127
fV30 Number 0003 #64 134
false Number 0000 #71 196 219 347
fnone Number 0000 #366 400
funk Number 00FF #69 227 #370 443
mCPU Text byte ptr [bx] #51 100 110 127 134 150 157 183 187 227
mGDT Text [bx + 3] #53 165
mIDT Text [bx + 9] #54 166
mMSW Text [bx + 1] #52 164
mNDP Text byte ptr [bx + 18] #58 400 407 428 435 443
mNDPCW Text [bx + 19] #59 439
mchkint Text byte ptr [bx + 16] #56 343 347
mmult Text byte ptr [bx + 17] #57 215 219
mopsize Text byte ptr [bx + 15] #55 196 200
ndp Near CODE:0142 80 #364
ndp_01 Near CODE:0170 398 #403
ndp_02 Near CODE:017B 405 #410
ndp_03 Near CODE:01AE 426 #431
ndp_04 Near CODE:01B7 408 429 #437
ndp_05 Near CODE:01C1 412 433 #442
ndp_cw Word DATA:0004 372 390 396 #517
ndp_save Byte DATA:0006 380 438 #518
ndp_sw Word DATA:0064 422 423 #519
new_int01 Near CODE:0126 296 298 #328
new_int01_01 Near CODE:0135 342 #346
new_int01_02 Near CODE:0139 344 #349
new_int01_03 Near CODE:0140 341 #356
number_of_sectors Text [bp + 8] #474 481
old_int01 Dword DATA:0000 321 #508
old_int01_ofs Word DATA:0000 288 #509
old_int01_seg Word DATA:0002 289 #510
Turbo Assembler Version 1.0 07-31-89 08:00:00 Page 10
Symbol Table
opincdx Number 0042 #244 247
opnop Number 0090 #245 256
piq Near CODE:00D2 96 123 146 #234
piq_01 Near CODE:00F1 252 #273
starting_sector Text [bp + 10] #473 480
true Number 0001 #72 200 215 343
Groups & Segments Bit Size Align Combine Class Cref defined at #
CODE 16 01E3 Byte none #25 31 454
DATA 16 0066 Byte none 31 #502